<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">      
    </head>
    <body>
        <?php
        $strPage = $_POST["tMode"];

       include ("Connect_To_Database.php");
        
        $strSQL = "SELECT * FROM giswebdatabase ";
        $objQuery = mysql_query($strSQL) or die("Error Query [" . $strSQL . "]");
        $Num_Rows = mysql_num_rows($objQuery);



        $Per_Page = 20;  // Per Page

        $Page = $strPage;
        if (!$strPage) {
            $Page = 1;
        }

        $Prev_Page = $Page - 1;
        $Next_Page = $Page + 1;

        $Page_Start = (($Per_Page * $Page) - $Per_Page);
        if ($Num_Rows <= $Per_Page) {
            $Num_Pages = 1;
        } else if (($Num_Rows % $Per_Page) == 0) {
            $Num_Pages = ($Num_Rows / $Per_Page);
        } else {
            $Num_Pages = ($Num_Rows / $Per_Page) + 1;
            $Num_Pages = (int) $Num_Pages;
        }

        $strSQL .=" order  by ID ASC LIMIT $Page_Start , $Per_Page";
        $objQuery = mysql_query($strSQL);
        ?>

       
        <table>                    
            <thead>
                <tr class="ui-bar-d">
                    <th >ID</th>
                    <th >USER_ID</th>
                    <th >PASSWORD</th>
                    <th >PID</th>
                    <th >E-MAIL</th>
                    <th >STATUS</th> 
                    <th >EMP_ID</th>
                    <th >EDIT</th>
                    <th >DELETE</th>
                </tr>
            </thead>
            <tbody>
                <?
                while ($objResult = mysql_fetch_array($objQuery)) {
                    ?>
                    <tr class="ui-bar-c"  >

                        <td  align="center" ><?= $objResult["ID"]; ?></td>
                        <td  align="center" ><?= $objResult["USER_ID"]; ?></td>
                        <td  align="center" ><?= $objResult["PASSWORD"]; ?></td>
                        <td  align="center" ><div align="center"><?= $objResult["PID"]; ?></div></td>
                        <td  align="center" ><div align="center"><?= $objResult["EMAIL"]; ?></div></td>
                        <td  align="center" ><?= $objResult["STATUS"]; ?></td> 
                        <td  align="center" ><?= $objResult["emp_id"]; ?></td> 
                        <td align="center"  ><a href="JavaScript:ShowEdit('<?= $objResult["ID"]; ?>', '<?= $objResult["USER_ID"]; ?>','<?= $objResult["PASSWORD"]; ?>','<?= $objResult["PID"]; ?>', '<?= $objResult["EMAIL"]; ?>','<?= $objResult["STATUS"]; ?>')">Edit</a></td>
                        <!--td align="center" rel="AdminList" ><a href="#AdminEdit" class="action" onclick="AdminEdit()" data-rel="dialog">Edit</a></td-->

                        <td align="center"   ><a href="#" onclick="AreYouSure('<?= $objResult["ID"]; ?>','<?= $objResult["USER_ID"]; ?>')">Delete</a></td>
                    </tr>
                    <?
                }
                ?>

            </tbody>
        </table> 
         <div style="width: 400px;">
            Totol <?= $Num_Rows; ?> ID For <?= $Num_Pages; ?> Page
        </div>
        
        <div style="width: 400px; height: 10px; ">
            <?
            if ($Prev_Page) {
                echo " <a href=\"JavaScript:AjaxListPage('$Prev_Page')\"><< Back</a> ";
            }

            for ($i = 1; $i <= $Num_Pages; $i++) {
                if ($i != $Page) {
                    echo "[ <a href=\"JavaScript:AjaxListPage('$i')\">$i</a> ]";
                } else {
                    echo "<b> $i </b>";
                }
            }
            if ($Page != $Num_Pages) {
                echo " <a href=\"JavaScript:AjaxListPage('$Next_Page')\">Next >></a> ";
            }

//mysql_close($objConnect);
            ?>
        </div>
        

       
    </body>
</html>